import { machineVerifyAxiosInstance } from '@/components/machine-verification/hooks/axiosInstance'
import type {
  machineVerifyCheckCodeRes,
  machineVerifyGetCodeRes
} from '@/components/machine-verification/hooks/request-types'

// 人机校验获取验证码
export function machineVerifyGetCode(appId: number): Promise<machineVerifyGetCodeRes> {
  return machineVerifyAxiosInstance.post('/captcha/get', {
    appId,
    captchaType: 'blockPuzzle', //滑块验证
    ts: new Date().getTime() //时间戳
  })
}
// 人机校验验证验证码正确性
export function machineVerifyCheckCode(
  pointJson: string,
  appId: number,
  token: string
): Promise<machineVerifyCheckCodeRes> {
  return machineVerifyAxiosInstance.post('/captcha/check', {
    pointJson,
    appId,
    token,
    ts: new Date().getTime(), //时间戳
    captchaType: 'blockPuzzle' //滑块验证
  })
}
